<?php

namespace App\Http\Controllers\Api\Client;

use App\Http\Controllers\Controller;
use App\Models\Api\Order;
use Illuminate\Http\Request;

class OrderController extends Controller
{
    //订单操作控制器

    //获取用户订单支付明细
    public function getOrderList(Request $request){
        $user_id=$request->get('id');
        if (empty($user_id)){//判断用户id是否存在
            return ['code'=>30304,'msg'=>'登录失效','data'=>''];
        }
        $orderData=Order::getUserOrderData($user_id);
        $orderData=$orderData->toArray();
        //判断查询数据
        if(empty($orderData)){
            return ['code'=>30201,'msg'=>'支付记录为空','data'=>''];
        }else{
            return ['code'=>30200,'msg'=>'获取成功','data'=>$orderData];
        }
    }

}
